package com.coin.exchange.bithumb.api.impl;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.coin.exchange.bithumb.api.BithumbPublicApi;

@Service
public class BithumbPublicApiImpl implements BithumbPublicApi {

	@Value("${bithumb.api.url}")
	private String url_prex = "https://api.bithumb.com";

	@Override
	public String getTicker(String currency) throws Exception {
		String url = url_prex + "/public/ticker/" + currency;
		String result = new RestTemplate().getForObject(url, String.class);
		return result;
	}

	@Override
	public String getOrderbook(String currency) throws Exception {
		String url = url_prex + "/public/orderbook/" + currency;
		String result = new RestTemplate().getForObject(url, String.class);
		return result;
	}

	@Override
	public String getRecentTransactions(String currency) throws Exception {
		String url = url_prex + "/public/recent_transactions/" + currency;
		String result = new RestTemplate().getForObject(url, String.class);
		return result;
	}
	
}
